<template>
  <div class="warehouse-aisle">
    <div class="track">
      <div class="stacker-crane" :style="{ left: stackerPosition + '%' }">
        <i class="fas fa-truck-loading"></i>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'WarehouseAisle',
  data() {
    return {
      stackerPosition: 0
    }
  },
  created() {
    this.animateStacker();
  },
  methods: {
    animateStacker() {
      let direction = 1;
      setInterval(() => {
        if (this.stackerPosition >= 95) direction = -1;
        if (this.stackerPosition <= 0) direction = 1;
        this.stackerPosition += direction * 0.5;
      }, 50);
    }
  }
}
</script>

<style scoped>
.warehouse-aisle {
  height: 3rem;
  margin: 1rem 0;
  padding-left: 3rem; /* Match row header width */
  position: relative;
}

.track {
  height: 100%;
  background: linear-gradient(
      to right,
      #e5e7eb 0%,
      #e5e7eb 2px,
      transparent 2px,
      transparent 8px
  ) repeat-x;
  background-size: 10px 100%;
  position: relative;
  border-radius: 4px;
  background-color: #f3f4f6;
}

.stacker-crane {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  background-color: #3B82F6;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  transition: left 0.05s linear;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stacker-crane i {
  transform: scale(1.2);
}
</style>
